package com.sinodata.bsm.center.util.web;

import org.apache.log4j.Logger;

import flex.messaging.log.LineFormattedTarget;
import flex.messaging.log.LogEvent;

public class Log4jTarget extends LineFormattedTarget {
    private static final Logger logger = Logger.getLogger("BlazeLogger");

    @Override
    public void logEvent(LogEvent event) {
        switch (event.level) {
            case LogEvent.NONE:
                break;
            case LogEvent.FATAL:
                logger.fatal(event.message, event.throwable);
                break;
            case LogEvent.ERROR:
                logger.error(event.message, event.throwable);
                break;
            case LogEvent.WARN:
                logger.warn(event.message);
                break;
            case LogEvent.INFO:
                //logger.info(event.message);
                break;
            case LogEvent.DEBUG:
                logger.debug(event.message);
                break;
            case LogEvent.ALL:
                logger.trace(event.message);
                break;
            default:
                logger.trace(event.message);
                return;
        }
    }

}
